using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VBHSATZ
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                case "YGR":
                case "TST":
                case "UBT":
                default:
                    #region=========
                    dwReturn["BHMANDANT"] = "00";
                    dwReturn["BHKART"] = "32598               ";
                    dwReturn["BHKVAR"] = "1 ";
                    dwReturn["BHAENDZL"] = "2";
                    dwReturn["BHAENDBEN"] = "INTEXE  ";
                    dwReturn["BHAENDDAT"] = "20151029";
                    dwReturn["BHNEUBEN"] = "INTEXE  ";
                    dwReturn["BHNEUDAT"] = "20151029";
                    dwReturn["BHFERTKZ"] = "E";
                    dwReturn["BHLIEFNR"] = "        ";
                    dwReturn["BHFILLER1"] = "          ";
                    dwReturn["BHLAN"] = "                    ";
                    dwReturn["BHKUNDNR"] = "        ";
                    dwReturn["BHHERART"] = "S";
                    dwReturn["BHSTATUS"] = "K";
                    dwReturn["BHSTAKZ"] = " ";
                    dwReturn["BHGASTUE"] = "V";
                    dwReturn["BHBASTUE"] = " ";
                    dwReturn["BHAUFTR"] = "N";
                    dwReturn["BHKGNET"] = "5168";
                    dwReturn["BHLGG"] = "0";
                    dwReturn["BHRSP"] = "0";
                    dwReturn["BHSCHLIGR1"] = " ";
                    dwReturn["BHSCHLIGR2"] = " ";
                    dwReturn["BHSCHLIGR3"] = " ";
                    dwReturn["BHSCHLIGR4"] = " ";
                    dwReturn["BHSCHLIGR5"] = " ";
                    dwReturn["BHSCHLIGR6"] = " ";
                    dwReturn["BHSCHLIGR7"] = " ";
                    dwReturn["BHSCHLIGR8"] = " ";
                    dwReturn["BHSCHLIGR9"] = " ";
                    dwReturn["BHSCHLIGR10"] = " ";
                    dwReturn["BHSCHLIGR11"] = " ";
                    dwReturn["BHSCHLIGR12"] = " ";
                    dwReturn["BHSCHLIGR13"] = " ";
                    dwReturn["BHSCHLIGR14"] = " ";
                    dwReturn["BHSCHLIGR15"] = " ";
                    dwReturn["BHSCHLINR1"] = "000";
                    dwReturn["BHSCHLINR2"] = "000";
                    dwReturn["BHSCHLINR3"] = "000";
                    dwReturn["BHSCHLINR4"] = "000";
                    dwReturn["BHSCHLINR5"] = "000";
                    dwReturn["BHSCHLINR6"] = "000";
                    dwReturn["BHSCHLINR7"] = "000";
                    dwReturn["BHSCHLINR8"] = "000";
                    dwReturn["BHSCHLINR9"] = "000";
                    dwReturn["BHSCHLINR10"] = "000";
                    dwReturn["BHSCHLINR11"] = "000";
                    dwReturn["BHSCHLINR12"] = "000";
                    dwReturn["BHSCHLINR13"] = "000";
                    dwReturn["BHSCHLINR14"] = "000";
                    dwReturn["BHSCHLINR15"] = "000";
                    dwReturn["BHCADKEY"] = "      ";
                    dwReturn["BHBEM"] = "                                        ";
                    dwReturn["BHDEKPR"] = "0";
                    dwReturn["BHZUGMENG"] = "0";
                    dwReturn["BHVRPR"] = "0";
                    dwReturn["BHLEPR"] = "0";
                    dwReturn["BHBWPR1"] = "0";
                    dwReturn["BHBWPR2"] = "0";
                    dwReturn["BHBWPR3"] = "0";
                    dwReturn["BHMATKTO"] = "      ";
                    dwReturn["BHKTO1"] = "      ";
                    dwReturn["BHEG"] = " ";
                    dwReturn["BHBON"] = " ";
                    dwReturn["BHZUSCHL11"] = "        ";
                    dwReturn["BHZUSCHL12"] = "        ";
                    dwReturn["BHZUSCHL13"] = "        ";
                    dwReturn["BHZUSCHL21"] = "        ";
                    dwReturn["BHZUSCHL22"] = "        ";
                    dwReturn["BHZUSCHL23"] = "        ";
                    dwReturn["BHABSABF"] = "0";
                    dwReturn["BHKALABF"] = "0";
                    dwReturn["BHAUFKZ"] = " ";
                    dwReturn["BHKETTLG"] = "0";
                    dwReturn["BHFERTZT"] = "0";
                    dwReturn["BHWDBSZT"] = "0";
                    dwReturn["BHDISPOKZ"] = "B";
                    dwReturn["BHDISPOZR"] = " ";
                    dwReturn["BHMINBST"] = "0";
                    dwReturn["BHMAXBST"] = "0";
                    dwReturn["BHBSLPKT"] = "0";
                    dwReturn["BHLO"] = "  ";
                    dwReturn["BHLB"] = "  ";
                    dwReturn["BHABCKL"] = " ";
                    dwReturn["BHSACHDSP"] = "        ";
                    dwReturn["BHPROF"] = " ";
                    dwReturn["BHPRUEFANW"] = " ";
                    dwReturn["BHTAX"] = "   ";
                    dwReturn["BHBKLAS"] = "    ";
                    dwReturn["BHSCHLIAUF"] = "0";
                    dwReturn["BHFILLER"] = "                                                                                                                                    ";

                    #endregion
                    break;
                case "JLT":

                    break;
            }
        }
        public void MapBHSATZ(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveBHSATZ(DataRow dwData, DataRow dwDispo)
        {

            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            SResult = QueryBHSATZ(dwData);
            if (SResult.Tables.Count > 0)
            {
                tbLocal = SResult.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapBHSATZ(ref dwLocal, dwData);

            if (!flgExist)
            {
                InsertBHSATZ(dwLocal);
            }
            UpdateBHSATZ(dwLocal);
        }
        public void InsertBHSATZ(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            switch (app.company)
            {
                case "YGR":
                case "TST":
                case "UBT":
                default:
                    or1.CommandText = "INSERT INTO BHSATZ ( BHMANDANT,BHKART,BHKVAR,BHAENDZL,BHAENDBEN,BHAENDDAT,BHNEUBEN,BHNEUDAT,BHFERTKZ,BHLIEFNR,BHFILLER1,BHLAN,BHKUNDNR,BHHERART,BHSTATUS,BHSTAKZ,BHGASTUE,BHBASTUE,BHAUFTR,BHKGNET,BHLGG,BHRSP,BHSCHLIGR1,BHSCHLIGR2,BHSCHLIGR3,BHSCHLIGR4,BHSCHLIGR5,BHSCHLIGR6,BHSCHLIGR7,BHSCHLIGR8,BHSCHLIGR9,BHSCHLIGR10,BHSCHLIGR11,BHSCHLIGR12,BHSCHLIGR13,BHSCHLIGR14,BHSCHLIGR15,BHSCHLINR1,BHSCHLINR2,BHSCHLINR3,BHSCHLINR4,BHSCHLINR5,BHSCHLINR6,BHSCHLINR7,BHSCHLINR8,BHSCHLINR9,BHSCHLINR10,BHSCHLINR11,BHSCHLINR12,BHSCHLINR13,BHSCHLINR14,BHSCHLINR15,BHCADKEY,BHBEM,BHDEKPR,BHZUGMENG,BHVRPR,BHLEPR,BHBWPR1,BHBWPR2,BHBWPR3,BHMATKTO,BHKTO1,BHEG,BHBON,BHZUSCHL11,BHZUSCHL12,BHZUSCHL13,BHZUSCHL21,BHZUSCHL22,BHZUSCHL23,BHABSABF,BHKALABF,BHAUFKZ,BHKETTLG,BHFERTZT,BHWDBSZT,BHDISPOKZ,BHDISPOZR,BHMINBST,BHMAXBST,BHBSLPKT,BHLO,BHLB,BHABCKL,BHSACHDSP,BHPROF,BHPRUEFANW,BHTAX,BHBKLAS,BHSCHLIAUF,BHFILLER)"
                    + " VALUES (:BHMANDANT:,:BHKART:,:BHKVAR:,:BHAENDZL:,:BHAENDBEN:,:BHAENDDAT:,:BHNEUBEN:,:BHNEUDAT:,:BHFERTKZ:,:BHLIEFNR:,:BHFILLER1:,:BHLAN:,:BHKUNDNR:,:BHHERART:,:BHSTATUS:,:BHSTAKZ:,:BHGASTUE:,:BHBASTUE:,:BHAUFTR:,:BHKGNET:,:BHLGG:,:BHRSP:,:BHSCHLIGR1:,:BHSCHLIGR2:,:BHSCHLIGR3:,:BHSCHLIGR4:,:BHSCHLIGR5:,:BHSCHLIGR6:,:BHSCHLIGR7:,:BHSCHLIGR8:,:BHSCHLIGR9:,:BHSCHLIGR10:,:BHSCHLIGR11:,:BHSCHLIGR12:,:BHSCHLIGR13:,:BHSCHLIGR14:,:BHSCHLIGR15:,:BHSCHLINR1:,:BHSCHLINR2:,:BHSCHLINR3:,:BHSCHLINR4:,:BHSCHLINR5:,:BHSCHLINR6:,:BHSCHLINR7:,:BHSCHLINR8:,:BHSCHLINR9:,:BHSCHLINR10:,:BHSCHLINR11:,:BHSCHLINR12:,:BHSCHLINR13:,:BHSCHLINR14:,:BHSCHLINR15:,:BHCADKEY:,:BHBEM:,:BHDEKPR:,:BHZUGMENG:,:BHVRPR:,:BHLEPR:,:BHBWPR1:,:BHBWPR2:,:BHBWPR3:,:BHMATKTO:,:BHKTO1:,:BHEG:,:BHBON:,:BHZUSCHL11:,:BHZUSCHL12:,:BHZUSCHL13:,:BHZUSCHL21:,:BHZUSCHL22:,:BHZUSCHL23:,:BHABSABF:,:BHKALABF:,:BHAUFKZ:,:BHKETTLG:,:BHFERTZT:,:BHWDBSZT:,:BHDISPOKZ:,:BHDISPOZR:,:BHMINBST:,:BHMAXBST:,:BHBSLPKT:,:BHLO:,:BHLB:,:BHABCKL:,:BHSACHDSP:,:BHPROF:,:BHPRUEFANW:,:BHTAX:,:BHBKLAS:,:BHSCHLIAUF:,:BHFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

                    break;
                case "JLT":
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "INSERT INTO BHSATZ(BHMANDANT,BHKART,BHKVAR,BHAENDZL,BHAENDBEN,BHAENDDAT,BHNEUBEN,BHNEUDAT,BHFERTKZ,BHLIEFNR,BHFILLER1,BHLAN,BHKUNDNR,BHHERART,BHSTATUS,BHSTAKZ,BHGASTUE,BHBASTUE,BHAUFTR,BHKGNET,BHLGG,BHRSP,BHSCHLIGR1,BHSCHLIGR2,BHSCHLIGR3,BHSCHLIGR4,BHSCHLIGR5,BHSCHLIGR6,BHSCHLIGR7,BHSCHLIGR8,BHSCHLIGR9,BHSCHLIGR10,BHSCHLIGR11,BHSCHLIGR12,BHSCHLIGR13,BHSCHLIGR14,BHSCHLIGR15,BHSCHLINR1,BHSCHLINR2,BHSCHLINR3,BHSCHLINR4,BHSCHLINR5,BHSCHLINR6,BHSCHLINR7,BHSCHLINR8,BHSCHLINR9,BHSCHLINR10,BHSCHLINR11,BHSCHLINR12,BHSCHLINR13,BHSCHLINR14,BHSCHLINR15,BHCADKEY,BHBEM,BHDEKPR,BHZUGMENG,BHVRPR,BHLEPR,BHBWPR1,BHBWPR2,BHBWPR3,BHMATKTO,BHKTO1,BHEG,BHBON,BHZUSCHL11,BHZUSCHL12,BHZUSCHL13,BHZUSCHL21,BHZUSCHL22,BHZUSCHL23,BHABSABF,BHKALABF,BHAUFKZ,BHKETTLG,BHFERTZT,BHWDBSZT,BHDISPOKZ,BHDISPOZR,BHMINBST,BHMAXBST,BHBSLPKT,BHLO,BHLB,BHABCKL,BHSACHDSP,BHPROF,BHPRUEFANW,BHTAX,BHBKLAS,BHSCHLIAUF,BHFILLER)"
                        + "VALUES (:BHMANDANT,:BHKART,:BHKVAR,:BHAENDZL,:BHAENDBEN,:BHAENDDAT,:BHNEUBEN,:BHNEUDAT,:BHFERTKZ,:BHLIEFNR,:BHFILLER1,:BHLAN,:BHKUNDNR,:BHHERART,:BHSTATUS,:BHSTAKZ,:BHGASTUE,:BHBASTUE,:BHAUFTR,:BHKGNET,:BHLGG,:BHRSP,:BHSCHLIGR1,:BHSCHLIGR2,:BHSCHLIGR3,:BHSCHLIGR4,:BHSCHLIGR5,:BHSCHLIGR6,:BHSCHLIGR7,:BHSCHLIGR8,:BHSCHLIGR9,:BHSCHLIGR10,:BHSCHLIGR11,:BHSCHLIGR12,:BHSCHLIGR13,:BHSCHLIGR14,:BHSCHLIGR15,:BHSCHLINR1,:BHSCHLINR2,:BHSCHLINR3,:BHSCHLINR4,:BHSCHLINR5,:BHSCHLINR6,:BHSCHLINR7,:BHSCHLINR8,:BHSCHLINR9,:BHSCHLINR10,:BHSCHLINR11,:BHSCHLINR12,:BHSCHLINR13,:BHSCHLINR14,:BHSCHLINR15,:BHCADKEY,:BHBEM,:BHDEKPR,:BHZUGMENG,:BHVRPR,:BHLEPR,:BHBWPR1,:BHBWPR2,:BHBWPR3,:BHMATKTO,:BHKTO1,:BHEG,:BHBON,:BHZUSCHL11,:BHZUSCHL12,:BHZUSCHL13,:BHZUSCHL21,:BHZUSCHL22,:BHZUSCHL23,:BHABSABF,:BHKALABF,:BHAUFKZ,:BHKETTLG,:BHFERTZT,:BHWDBSZT,:BHDISPOKZ,:BHDISPOZR,:BHMINBST,:BHMAXBST,:BHBSLPKT,:BHLO,:BHLB,:BHABCKL,:BHSACHDSP,:BHPROF,:BHPRUEFANW,:BHTAX,:BHBKLAS,:BHSCHLIAUF,:BHFILLER)";
                    or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = dwData["BHMANDANT"].ToString();
                    or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = dwData["BHKART"].ToString();
                    or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = dwData["BHKVAR"].ToString();
                    or1.Parameters.Add("BHAENDZL", OracleType.NVarChar).Value = dwData["BHAENDZL"].ToString();
                    or1.Parameters.Add("BHAENDBEN", OracleType.NVarChar).Value = dwData["BHAENDBEN"].ToString();
                    or1.Parameters.Add("BHAENDDAT", OracleType.NVarChar).Value = dwData["BHAENDDAT"].ToString();
                    or1.Parameters.Add("BHNEUBEN", OracleType.NVarChar).Value = dwData["BHNEUBEN"].ToString();
                    or1.Parameters.Add("BHNEUDAT", OracleType.NVarChar).Value = dwData["BHNEUDAT"].ToString();
                    or1.Parameters.Add("BHFERTKZ", OracleType.NVarChar).Value = dwData["BHFERTKZ"].ToString();
                    or1.Parameters.Add("BHLIEFNR", OracleType.NVarChar).Value = dwData["BHLIEFNR"].ToString();
                    or1.Parameters.Add("BHFILLER1", OracleType.NVarChar).Value = dwData["BHFILLER1"].ToString();
                    or1.Parameters.Add("BHLAN", OracleType.NVarChar).Value = dwData["BHLAN"].ToString();
                    or1.Parameters.Add("BHKUNDNR", OracleType.NVarChar).Value = dwData["BHKUNDNR"].ToString();
                    or1.Parameters.Add("BHHERART", OracleType.NVarChar).Value = dwData["BHHERART"].ToString();
                    or1.Parameters.Add("BHSTATUS", OracleType.NVarChar).Value = dwData["BHSTATUS"].ToString();
                    or1.Parameters.Add("BHSTAKZ", OracleType.NVarChar).Value = dwData["BHSTAKZ"].ToString();
                    or1.Parameters.Add("BHGASTUE", OracleType.NVarChar).Value = dwData["BHGASTUE"].ToString();
                    or1.Parameters.Add("BHBASTUE", OracleType.NVarChar).Value = dwData["BHBASTUE"].ToString();
                    or1.Parameters.Add("BHAUFTR", OracleType.NVarChar).Value = dwData["BHAUFTR"].ToString();
                    or1.Parameters.Add("BHKGNET", OracleType.NVarChar).Value = dwData["BHKGNET"].ToString();
                    or1.Parameters.Add("BHLGG", OracleType.NVarChar).Value = dwData["BHLGG"].ToString();
                    or1.Parameters.Add("BHRSP", OracleType.NVarChar).Value = dwData["BHRSP"].ToString();
                    or1.Parameters.Add("BHSCHLIGR1", OracleType.NVarChar).Value = dwData["BHSCHLIGR1"].ToString();
                    or1.Parameters.Add("BHSCHLIGR2", OracleType.NVarChar).Value = dwData["BHSCHLIGR2"].ToString();
                    or1.Parameters.Add("BHSCHLIGR3", OracleType.NVarChar).Value = dwData["BHSCHLIGR3"].ToString();
                    or1.Parameters.Add("BHSCHLIGR4", OracleType.NVarChar).Value = dwData["BHSCHLIGR4"].ToString();
                    or1.Parameters.Add("BHSCHLIGR5", OracleType.NVarChar).Value = dwData["BHSCHLIGR5"].ToString();
                    or1.Parameters.Add("BHSCHLIGR6", OracleType.NVarChar).Value = dwData["BHSCHLIGR6"].ToString();
                    or1.Parameters.Add("BHSCHLIGR7", OracleType.NVarChar).Value = dwData["BHSCHLIGR7"].ToString();
                    or1.Parameters.Add("BHSCHLIGR8", OracleType.NVarChar).Value = dwData["BHSCHLIGR8"].ToString();
                    or1.Parameters.Add("BHSCHLIGR9", OracleType.NVarChar).Value = dwData["BHSCHLIGR9"].ToString();
                    or1.Parameters.Add("BHSCHLIGR10", OracleType.NVarChar).Value = dwData["BHSCHLIGR10"].ToString();
                    or1.Parameters.Add("BHSCHLIGR11", OracleType.NVarChar).Value = dwData["BHSCHLIGR11"].ToString();
                    or1.Parameters.Add("BHSCHLIGR12", OracleType.NVarChar).Value = dwData["BHSCHLIGR12"].ToString();
                    or1.Parameters.Add("BHSCHLIGR13", OracleType.NVarChar).Value = dwData["BHSCHLIGR13"].ToString();
                    or1.Parameters.Add("BHSCHLIGR14", OracleType.NVarChar).Value = dwData["BHSCHLIGR14"].ToString();
                    or1.Parameters.Add("BHSCHLIGR15", OracleType.NVarChar).Value = dwData["BHSCHLIGR15"].ToString();
                    or1.Parameters.Add("BHSCHLINR1", OracleType.NVarChar).Value = dwData["BHSCHLINR1"].ToString();
                    or1.Parameters.Add("BHSCHLINR2", OracleType.NVarChar).Value = dwData["BHSCHLINR2"].ToString();
                    or1.Parameters.Add("BHSCHLINR3", OracleType.NVarChar).Value = dwData["BHSCHLINR3"].ToString();
                    or1.Parameters.Add("BHSCHLINR4", OracleType.NVarChar).Value = dwData["BHSCHLINR4"].ToString();
                    or1.Parameters.Add("BHSCHLINR5", OracleType.NVarChar).Value = dwData["BHSCHLINR5"].ToString();
                    or1.Parameters.Add("BHSCHLINR6", OracleType.NVarChar).Value = dwData["BHSCHLINR6"].ToString();
                    or1.Parameters.Add("BHSCHLINR7", OracleType.NVarChar).Value = dwData["BHSCHLINR7"].ToString();
                    or1.Parameters.Add("BHSCHLINR8", OracleType.NVarChar).Value = dwData["BHSCHLINR8"].ToString();
                    or1.Parameters.Add("BHSCHLINR9", OracleType.NVarChar).Value = dwData["BHSCHLINR9"].ToString();
                    or1.Parameters.Add("BHSCHLINR10", OracleType.NVarChar).Value = dwData["BHSCHLINR10"].ToString();
                    or1.Parameters.Add("BHSCHLINR11", OracleType.NVarChar).Value = dwData["BHSCHLINR11"].ToString();
                    or1.Parameters.Add("BHSCHLINR12", OracleType.NVarChar).Value = dwData["BHSCHLINR12"].ToString();
                    or1.Parameters.Add("BHSCHLINR13", OracleType.NVarChar).Value = dwData["BHSCHLINR13"].ToString();
                    or1.Parameters.Add("BHSCHLINR14", OracleType.NVarChar).Value = dwData["BHSCHLINR14"].ToString();
                    or1.Parameters.Add("BHSCHLINR15", OracleType.NVarChar).Value = dwData["BHSCHLINR15"].ToString();
                    or1.Parameters.Add("BHCADKEY", OracleType.NVarChar).Value = dwData["BHCADKEY"].ToString();
                    or1.Parameters.Add("BHBEM", OracleType.NVarChar).Value = dwData["BHBEM"].ToString();
                    or1.Parameters.Add("BHDEKPR", OracleType.NVarChar).Value = dwData["BHDEKPR"].ToString();
                    or1.Parameters.Add("BHZUGMENG", OracleType.NVarChar).Value = dwData["BHZUGMENG"].ToString();
                    or1.Parameters.Add("BHVRPR", OracleType.NVarChar).Value = dwData["BHVRPR"].ToString();
                    or1.Parameters.Add("BHLEPR", OracleType.NVarChar).Value = dwData["BHLEPR"].ToString();
                    or1.Parameters.Add("BHBWPR1", OracleType.NVarChar).Value = dwData["BHBWPR1"].ToString();
                    or1.Parameters.Add("BHBWPR2", OracleType.NVarChar).Value = dwData["BHBWPR2"].ToString();
                    or1.Parameters.Add("BHBWPR3", OracleType.NVarChar).Value = dwData["BHBWPR3"].ToString();
                    or1.Parameters.Add("BHMATKTO", OracleType.NVarChar).Value = dwData["BHMATKTO"].ToString();
                    or1.Parameters.Add("BHKTO1", OracleType.NVarChar).Value = dwData["BHKTO1"].ToString();
                    or1.Parameters.Add("BHEG", OracleType.NVarChar).Value = dwData["BHEG"].ToString();
                    or1.Parameters.Add("BHBON", OracleType.NVarChar).Value = dwData["BHBON"].ToString();
                    or1.Parameters.Add("BHZUSCHL11", OracleType.NVarChar).Value = dwData["BHZUSCHL11"].ToString();
                    or1.Parameters.Add("BHZUSCHL12", OracleType.NVarChar).Value = dwData["BHZUSCHL12"].ToString();
                    or1.Parameters.Add("BHZUSCHL13", OracleType.NVarChar).Value = dwData["BHZUSCHL13"].ToString();
                    or1.Parameters.Add("BHZUSCHL21", OracleType.NVarChar).Value = dwData["BHZUSCHL21"].ToString();
                    or1.Parameters.Add("BHZUSCHL22", OracleType.NVarChar).Value = dwData["BHZUSCHL22"].ToString();
                    or1.Parameters.Add("BHZUSCHL23", OracleType.NVarChar).Value = dwData["BHZUSCHL23"].ToString();
                    or1.Parameters.Add("BHABSABF", OracleType.NVarChar).Value = dwData["BHABSABF"].ToString();
                    or1.Parameters.Add("BHKALABF", OracleType.NVarChar).Value = dwData["BHKALABF"].ToString();
                    or1.Parameters.Add("BHAUFKZ", OracleType.NVarChar).Value = dwData["BHAUFKZ"].ToString();
                    or1.Parameters.Add("BHKETTLG", OracleType.NVarChar).Value = dwData["BHKETTLG"].ToString();
                    or1.Parameters.Add("BHFERTZT", OracleType.NVarChar).Value = dwData["BHFERTZT"].ToString();
                    or1.Parameters.Add("BHWDBSZT", OracleType.NVarChar).Value = dwData["BHWDBSZT"].ToString();
                    or1.Parameters.Add("BHDISPOKZ", OracleType.NVarChar).Value = dwData["BHDISPOKZ"].ToString();
                    or1.Parameters.Add("BHDISPOZR", OracleType.NVarChar).Value = dwData["BHDISPOZR"].ToString();
                    or1.Parameters.Add("BHMINBST", OracleType.NVarChar).Value = dwData["BHMINBST"].ToString();
                    or1.Parameters.Add("BHMAXBST", OracleType.NVarChar).Value = dwData["BHMAXBST"].ToString();
                    or1.Parameters.Add("BHBSLPKT", OracleType.NVarChar).Value = dwData["BHBSLPKT"].ToString();
                    or1.Parameters.Add("BHLO", OracleType.NVarChar).Value = dwData["BHLO"].ToString();
                    or1.Parameters.Add("BHLB", OracleType.NVarChar).Value = dwData["BHLB"].ToString();
                    or1.Parameters.Add("BHABCKL", OracleType.NVarChar).Value = dwData["BHABCKL"].ToString();
                    or1.Parameters.Add("BHSACHDSP", OracleType.NVarChar).Value = dwData["BHSACHDSP"].ToString();
                    or1.Parameters.Add("BHPROF", OracleType.NVarChar).Value = dwData["BHPROF"].ToString();
                    or1.Parameters.Add("BHPRUEFANW", OracleType.NVarChar).Value = dwData["BHPRUEFANW"].ToString();
                    or1.Parameters.Add("BHTAX", OracleType.NVarChar).Value = dwData["BHTAX"].ToString();
                    or1.Parameters.Add("BHBKLAS", OracleType.NVarChar).Value = dwData["BHBKLAS"].ToString();
                    or1.Parameters.Add("BHSCHLIAUF", OracleType.NVarChar).Value = dwData["BHSCHLIAUF"].ToString();
                    or1.Parameters.Add("BHFILLER", OracleType.NVarChar).Value = dwData["BHFILLER"].ToString();

                    break;
            }
            Connect2Proxy(or1);
        }
        public override string BATCHINSERT(DataRow dwData)
        { 
            dwData["BHAENDBEN"] = app.User;
            dwData["BHAENDDAT"] = date;
            string value = "";
            switch (app.company)
            {
                default:
                case "SXN":
                case "YGR":
                case "TST":
                    value = "INTO BHSATZ  "
                    + " VALUES (:BHMANDANT:,:BHKART:,:BHKAR:,:BHAENDZL:,:BHAENDBEN:,:BHAENDDAT:,:BHNEUBEN:,:BHNEUDAT:,:BHFERTKZ:,:BHLIEFNR:,:BHFILLER1:,:BHLAN:,:BHKUNDNR:,:BHHERART:,:BHSTATUS:,:BHSTAKZ:,:BHGASTUE:,:BHBASTUE:,:BHAUFTR:,:BHKGNET:,:BHLGG:,:BHRSP:,:BHSCHLIGR1:,:BHSCHLIGR2:,:BHSCHLIGR3:,:BHSCHLIGR4:,:BHSCHLIGR5:,:BHSCHLIGR6:,:BHSCHLIGR7:,:BHSCHLIGR8:,:BHSCHLIGR9:,:BHSCHLIGR10:,:BHSCHLIGR11:,:BHSCHLIGR12:,:BHSCHLIGR13:,:BHSCHLIGR14:,:BHSCHLIGR15:,:BHSCHLINR1:,:BHSCHLINR2:,:BHSCHLINR3:,:BHSCHLINR4:,:BHSCHLINR5:,:BHSCHLINR6:,:BHSCHLINR7:,:BHSCHLINR8:,:BHSCHLINR9:,:BHSCHLINR10:,:BHSCHLINR11:,:BHSCHLINR12:,:BHSCHLINR13:,:BHSCHLINR14:,:BHSCHLINR15:,:BHCADKEY:,:BHBEM:,:BHDEKPR:,:BHZUGMENG:,:BHVRPR:,:BHLEPR:,:BHBWPR1:,:BHBWPR2:,:BHBWPR3:,:BHMATKTO:,:BHKTO1:,:BHEG:,:BHBON:,:BHZUSCHL11:,:BHZUSCHL12:,:BHZUSCHL13:,:BHZUSCHL21:,:BHZUSCHL22:,:BHZUSCHL23:,:BHABSABF:,:BHKALABF:,:BHAUFKZ:,:BHKETTLG:,:BHFERTZT:,:BHWDBSZT:,:BHDISPOKZ:,:BHDISPOZR:,:BHMINBST:,:BHMAXBST:,:BHBSLPKT:,:BHLO:,:BHLB:,:BHABCKL:,:BHSACHDSP:,:BHPROF:,:BHPRUEFANW:,:BHTAX:,:BHBKLAS:,:BHSCHLIAUF:,:BHFILLER:)";
                    value = INTEXDBC.InjectData(value, dwData);
                    break;
            }
            return value;
        }
        public void DeleteBHSATZ(string client, string art, string var)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE BHSATZ"
           + " WHERE BHMANDANT=:BHMANDANT AND BHKART=:BHKART AND BHKVAR=:BHKVAR";
            or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = client;
            or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = art;
            or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = var;
            Connect2Proxy(or1);
        }
        public void DBHSATZ01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "DELETE BHSATZ"
           + " WHERE BHMANDANT=:BHMANDANT: AND BHKART=:BHKART: AND BHKVAR=:BHKVAR:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData); 
            Connect2Proxy(or1);
        }
        public void UpdateBHSATZ(DataRow dwData, int option = 1)

        {
            if (option == 0)
            {
                switch (app.company)
                {
                    case "JLT":
                        UBH01(dwData);
                        break;
                    case "YGR":
                    case "TST":
                    case "UBT":
                    default:
                        UBH02(dwData);
                        break;
                }
            }
        }


        public void UBH01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE BHSATZ SET "
                + "BHMANDANT=:BHMANDANT,"
                + "BHKART=:BHKART,"
                + "BHKVAR=:BHKVAR,"
                + "BHAENDZL=:BHAENDZL,"
                + "BHAENDBEN=:BHAENDBEN,"
                + "BHAENDDAT=:BHAENDDAT,"
                + "BHNEUBEN=:BHNEUBEN,"
                + "BHNEUDAT=:BHNEUDAT,"
                + "BHFERTKZ=:BHFERTKZ,"
                + "BHLIEFNR=:BHLIEFNR,"
                + "BHFILLER1=:BHFILLER1,"
                + "BHLAN=:BHLAN,"
                + "BHKUNDNR=:BHKUNDNR,"
                + "BHHERART=:BHHERART,"
                + "BHSTATUS=:BHSTATUS,"
                + "BHSTAKZ=:BHSTAKZ,"
                + "BHGASTUE=:BHGASTUE,"
                + "BHBASTUE=:BHBASTUE,"
                + "BHAUFTR=:BHAUFTR,"
                + "BHKGNET=:BHKGNET,"
                + "BHLGG=:BHLGG,"
                + "BHRSP=:BHRSP,"
                + "BHSCHLIGR1=:BHSCHLIGR1,"
                + "BHSCHLIGR2=:BHSCHLIGR2,"
                + "BHSCHLIGR3=:BHSCHLIGR3,"
                + "BHSCHLIGR4=:BHSCHLIGR4,"
                + "BHSCHLIGR5=:BHSCHLIGR5,"
                + "BHSCHLIGR6=:BHSCHLIGR6,"
                + "BHSCHLIGR7=:BHSCHLIGR7,"
                + "BHSCHLIGR8=:BHSCHLIGR8,"
                + "BHSCHLIGR9=:BHSCHLIGR9,"
                + "BHSCHLIGR10=:BHSCHLIGR10,"
                + "BHSCHLIGR11=:BHSCHLIGR11,"
                + "BHSCHLIGR12=:BHSCHLIGR12,"
                + "BHSCHLIGR13=:BHSCHLIGR13,"
                + "BHSCHLIGR14=:BHSCHLIGR14,"
                + "BHSCHLIGR15=:BHSCHLIGR15,"
                + "BHSCHLINR1=:BHSCHLINR1,"
                + "BHSCHLINR2=:BHSCHLINR2,"
                + "BHSCHLINR3=:BHSCHLINR3,"
                + "BHSCHLINR4=:BHSCHLINR4,"
                + "BHSCHLINR5=:BHSCHLINR5,"
                + "BHSCHLINR6=:BHSCHLINR6,"
                + "BHSCHLINR7=:BHSCHLINR7,"
                + "BHSCHLINR8=:BHSCHLINR8,"
                + "BHSCHLINR9=:BHSCHLINR9,"
                + "BHSCHLINR10=:BHSCHLINR10,"
                + "BHSCHLINR11=:BHSCHLINR11,"
                + "BHSCHLINR12=:BHSCHLINR12,"
                + "BHSCHLINR13=:BHSCHLINR13,"
                + "BHSCHLINR14=:BHSCHLINR14,"
                + "BHSCHLINR15=:BHSCHLINR15,"
                + "BHCADKEY=:BHCADKEY,"
                + "BHBEM=:BHBEM,"
                + "BHDEKPR=:BHDEKPR,"
                + "BHZUGMENG=:BHZUGMENG,"
                + "BHVRPR=:BHVRPR,"
                + "BHLEPR=:BHLEPR,"
                + "BHBWPR1=:BHBWPR1,"
                + "BHBWPR2=:BHBWPR2,"
                + "BHBWPR3=:BHBWPR3,"
                + "BHMATKTO=:BHMATKTO,"
                + "BHKTO1=:BHKTO1,"
                + "BHEG=:BHEG,"
                + "BHBON=:BHBON,"
                + "BHZUSCHL11=:BHZUSCHL11,"
                + "BHZUSCHL12=:BHZUSCHL12,"
                + "BHZUSCHL13=:BHZUSCHL13,"
                + "BHZUSCHL21=:BHZUSCHL21,"
                + "BHZUSCHL22=:BHZUSCHL22,"
                + "BHZUSCHL23=:BHZUSCHL23,"
                + "BHABSABF=:BHABSABF,"
                + "BHKALABF=:BHKALABF,"
                + "BHAUFKZ=:BHAUFKZ,"
                + "BHKETTLG=:BHKETTLG,"
                + "BHFERTZT=:BHFERTZT,"
                + "BHWDBSZT=:BHWDBSZT,"
                + "BHDISPOKZ=:BHDISPOKZ,"
                + "BHDISPOZR=:BHDISPOZR,"
                + "BHMINBST=:BHMINBST,"
                + "BHMAXBST=:BHMAXBST,"
                + "BHBSLPKT=:BHBSLPKT,"
                + "BHLO=:BHLO,"
                + "BHLB=:BHLB,"
                + "BHABCKL=:BHABCKL,"
                + "BHSACHDSP=:BHSACHDSP,"
                + "BHPROF=:BHPROF,"
                + "BHPRUEFANW=:BHPRUEFANW,"
                + "BHTAX=:BHTAX,"
                + "BHFILLER=:BHFILLER "
                + " WHERE BHMANDANT=:BHMANDANT AND BHKART=:BHKART  AND BHKVAR=:BHKVAR";
            or1.Parameters.Add("BHMANDANT", OracleType.NVarChar).Value = dwData["BHMANDANT"].ToString();
            or1.Parameters.Add("BHKART", OracleType.NVarChar).Value = dwData["BHKART"].ToString();
            or1.Parameters.Add("BHKVAR", OracleType.NVarChar).Value = dwData["BHKVAR"].ToString();
            or1.Parameters.Add("BHAENDZL", OracleType.NVarChar).Value = dwData["BHAENDZL"].ToString();
            or1.Parameters.Add("BHAENDBEN", OracleType.NVarChar).Value = dwData["BHAENDBEN"].ToString();
            or1.Parameters.Add("BHAENDDAT", OracleType.NVarChar).Value = dwData["BHAENDDAT"].ToString();
            or1.Parameters.Add("BHNEUBEN", OracleType.NVarChar).Value = dwData["BHNEUBEN"].ToString();
            or1.Parameters.Add("BHNEUDAT", OracleType.NVarChar).Value = dwData["BHNEUDAT"].ToString();
            or1.Parameters.Add("BHFERTKZ", OracleType.NVarChar).Value = dwData["BHFERTKZ"].ToString();
            or1.Parameters.Add("BHLIEFNR", OracleType.NVarChar).Value = dwData["BHLIEFNR"].ToString();
            or1.Parameters.Add("BHFILLER1", OracleType.NVarChar).Value = dwData["BHFILLER1"].ToString();
            or1.Parameters.Add("BHLAN", OracleType.NVarChar).Value = dwData["BHLAN"].ToString();
            or1.Parameters.Add("BHKUNDNR", OracleType.NVarChar).Value = dwData["BHKUNDNR"].ToString();
            or1.Parameters.Add("BHHERART", OracleType.NVarChar).Value = dwData["BHHERART"].ToString();
            or1.Parameters.Add("BHSTATUS", OracleType.NVarChar).Value = dwData["BHSTATUS"].ToString();
            or1.Parameters.Add("BHSTAKZ", OracleType.NVarChar).Value = dwData["BHSTAKZ"].ToString();
            or1.Parameters.Add("BHGASTUE", OracleType.NVarChar).Value = dwData["BHGASTUE"].ToString();
            or1.Parameters.Add("BHBASTUE", OracleType.NVarChar).Value = dwData["BHBASTUE"].ToString();
            or1.Parameters.Add("BHAUFTR", OracleType.NVarChar).Value = dwData["BHAUFTR"].ToString();
            or1.Parameters.Add("BHKGNET", OracleType.NVarChar).Value = dwData["BHKGNET"].ToString();
            or1.Parameters.Add("BHLGG", OracleType.NVarChar).Value = dwData["BHLGG"].ToString();
            or1.Parameters.Add("BHRSP", OracleType.NVarChar).Value = dwData["BHRSP"].ToString();
            or1.Parameters.Add("BHSCHLIGR1", OracleType.NVarChar).Value = dwData["BHSCHLIGR1"].ToString();
            or1.Parameters.Add("BHSCHLIGR2", OracleType.NVarChar).Value = dwData["BHSCHLIGR2"].ToString();
            or1.Parameters.Add("BHSCHLIGR3", OracleType.NVarChar).Value = dwData["BHSCHLIGR3"].ToString();
            or1.Parameters.Add("BHSCHLIGR4", OracleType.NVarChar).Value = dwData["BHSCHLIGR4"].ToString();
            or1.Parameters.Add("BHSCHLIGR5", OracleType.NVarChar).Value = dwData["BHSCHLIGR5"].ToString();
            or1.Parameters.Add("BHSCHLIGR6", OracleType.NVarChar).Value = dwData["BHSCHLIGR6"].ToString();
            or1.Parameters.Add("BHSCHLIGR7", OracleType.NVarChar).Value = dwData["BHSCHLIGR7"].ToString();
            or1.Parameters.Add("BHSCHLIGR8", OracleType.NVarChar).Value = dwData["BHSCHLIGR8"].ToString();
            or1.Parameters.Add("BHSCHLIGR9", OracleType.NVarChar).Value = dwData["BHSCHLIGR9"].ToString();
            or1.Parameters.Add("BHSCHLIGR10", OracleType.NVarChar).Value = dwData["BHSCHLIGR10"].ToString();
            or1.Parameters.Add("BHSCHLIGR11", OracleType.NVarChar).Value = dwData["BHSCHLIGR11"].ToString();
            or1.Parameters.Add("BHSCHLIGR12", OracleType.NVarChar).Value = dwData["BHSCHLIGR12"].ToString();
            or1.Parameters.Add("BHSCHLIGR13", OracleType.NVarChar).Value = dwData["BHSCHLIGR13"].ToString();
            or1.Parameters.Add("BHSCHLIGR14", OracleType.NVarChar).Value = dwData["BHSCHLIGR14"].ToString();
            or1.Parameters.Add("BHSCHLIGR15", OracleType.NVarChar).Value = dwData["BHSCHLIGR15"].ToString();
            or1.Parameters.Add("BHSCHLINR1", OracleType.NVarChar).Value = dwData["BHSCHLINR1"].ToString();
            or1.Parameters.Add("BHSCHLINR2", OracleType.NVarChar).Value = dwData["BHSCHLINR2"].ToString();
            or1.Parameters.Add("BHSCHLINR3", OracleType.NVarChar).Value = dwData["BHSCHLINR3"].ToString();
            or1.Parameters.Add("BHSCHLINR4", OracleType.NVarChar).Value = dwData["BHSCHLINR4"].ToString();
            or1.Parameters.Add("BHSCHLINR5", OracleType.NVarChar).Value = dwData["BHSCHLINR5"].ToString();
            or1.Parameters.Add("BHSCHLINR6", OracleType.NVarChar).Value = dwData["BHSCHLINR6"].ToString();
            or1.Parameters.Add("BHSCHLINR7", OracleType.NVarChar).Value = dwData["BHSCHLINR7"].ToString();
            or1.Parameters.Add("BHSCHLINR8", OracleType.NVarChar).Value = dwData["BHSCHLINR8"].ToString();
            or1.Parameters.Add("BHSCHLINR9", OracleType.NVarChar).Value = dwData["BHSCHLINR9"].ToString();
            or1.Parameters.Add("BHSCHLINR10", OracleType.NVarChar).Value = dwData["BHSCHLINR10"].ToString();
            or1.Parameters.Add("BHSCHLINR11", OracleType.NVarChar).Value = dwData["BHSCHLINR11"].ToString();
            or1.Parameters.Add("BHSCHLINR12", OracleType.NVarChar).Value = dwData["BHSCHLINR12"].ToString();
            or1.Parameters.Add("BHSCHLINR13", OracleType.NVarChar).Value = dwData["BHSCHLINR13"].ToString();
            or1.Parameters.Add("BHSCHLINR14", OracleType.NVarChar).Value = dwData["BHSCHLINR14"].ToString();
            or1.Parameters.Add("BHSCHLINR15", OracleType.NVarChar).Value = dwData["BHSCHLINR15"].ToString();
            or1.Parameters.Add("BHCADKEY", OracleType.NVarChar).Value = dwData["BHCADKEY"].ToString();
            or1.Parameters.Add("BHBEM", OracleType.NVarChar).Value = dwData["BHBEM"].ToString();
            or1.Parameters.Add("BHDEKPR", OracleType.NVarChar).Value = dwData["BHDEKPR"].ToString();
            or1.Parameters.Add("BHZUGMENG", OracleType.NVarChar).Value = dwData["BHZUGMENG"].ToString();
            or1.Parameters.Add("BHVRPR", OracleType.NVarChar).Value = dwData["BHVRPR"].ToString();
            or1.Parameters.Add("BHLEPR", OracleType.NVarChar).Value = dwData["BHLEPR"].ToString();
            or1.Parameters.Add("BHBWPR1", OracleType.NVarChar).Value = dwData["BHBWPR1"].ToString();
            or1.Parameters.Add("BHBWPR2", OracleType.NVarChar).Value = dwData["BHBWPR2"].ToString();
            or1.Parameters.Add("BHBWPR3", OracleType.NVarChar).Value = dwData["BHBWPR3"].ToString();
            or1.Parameters.Add("BHMATKTO", OracleType.NVarChar).Value = dwData["BHMATKTO"].ToString();
            or1.Parameters.Add("BHKTO1", OracleType.NVarChar).Value = dwData["BHKTO1"].ToString();
            or1.Parameters.Add("BHEG", OracleType.NVarChar).Value = dwData["BHEG"].ToString();
            or1.Parameters.Add("BHBON", OracleType.NVarChar).Value = dwData["BHBON"].ToString();
            or1.Parameters.Add("BHZUSCHL11", OracleType.NVarChar).Value = dwData["BHZUSCHL11"].ToString();
            or1.Parameters.Add("BHZUSCHL12", OracleType.NVarChar).Value = dwData["BHZUSCHL12"].ToString();
            or1.Parameters.Add("BHZUSCHL13", OracleType.NVarChar).Value = dwData["BHZUSCHL13"].ToString();
            or1.Parameters.Add("BHZUSCHL21", OracleType.NVarChar).Value = dwData["BHZUSCHL21"].ToString();
            or1.Parameters.Add("BHZUSCHL22", OracleType.NVarChar).Value = dwData["BHZUSCHL22"].ToString();
            or1.Parameters.Add("BHZUSCHL23", OracleType.NVarChar).Value = dwData["BHZUSCHL23"].ToString();
            or1.Parameters.Add("BHABSABF", OracleType.NVarChar).Value = dwData["BHABSABF"].ToString();
            or1.Parameters.Add("BHKALABF", OracleType.NVarChar).Value = dwData["BHKALABF"].ToString();
            or1.Parameters.Add("BHAUFKZ", OracleType.NVarChar).Value = dwData["BHAUFKZ"].ToString();
            or1.Parameters.Add("BHKETTLG", OracleType.NVarChar).Value = dwData["BHKETTLG"].ToString();
            or1.Parameters.Add("BHFERTZT", OracleType.NVarChar).Value = dwData["BHFERTZT"].ToString();
            or1.Parameters.Add("BHWDBSZT", OracleType.NVarChar).Value = dwData["BHWDBSZT"].ToString();
            or1.Parameters.Add("BHDISPOKZ", OracleType.NVarChar).Value = dwData["BHDISPOKZ"].ToString();
            or1.Parameters.Add("BHDISPOZR", OracleType.NVarChar).Value = dwData["BHDISPOZR"].ToString();
            or1.Parameters.Add("BHMINBST", OracleType.NVarChar).Value = dwData["BHMINBST"].ToString();
            or1.Parameters.Add("BHMAXBST", OracleType.NVarChar).Value = dwData["BHMAXBST"].ToString();
            or1.Parameters.Add("BHBSLPKT", OracleType.NVarChar).Value = dwData["BHBSLPKT"].ToString();
            or1.Parameters.Add("BHLO", OracleType.NVarChar).Value = dwData["BHLO"].ToString();
            or1.Parameters.Add("BHLB", OracleType.NVarChar).Value = dwData["BHLB"].ToString();
            or1.Parameters.Add("BHABCKL", OracleType.NVarChar).Value = dwData["BHABCKL"].ToString();
            or1.Parameters.Add("BHSACHDSP", OracleType.NVarChar).Value = dwData["BHSACHDSP"].ToString();
            or1.Parameters.Add("BHPROF", OracleType.NVarChar).Value = dwData["BHPROF"].ToString();
            or1.Parameters.Add("BHPRUEFANW", OracleType.NVarChar).Value = dwData["BHPRUEFANW"].ToString();
            or1.Parameters.Add("BHTAX", OracleType.NVarChar).Value = dwData["BHTAX"].ToString();
            or1.Parameters.Add("BHFILLER", OracleType.NVarChar).Value = dwData["BHFILLER"].ToString();
            Connect2Proxy(or1);
        }
        public void UBH02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE BHSATZ SET BHMANDANT=:BHMANDANT:,BHKART=:BHKART:,BHKVAR=:BHKVAR:,BHAENDZL=:BHAENDZL:,BHAENDBEN=:BHAENDBEN:,BHAENDDAT=:BHAENDDAT:,BHNEUBEN=:BHNEUBEN:,BHNEUDAT=:BHNEUDAT:,BHFERTKZ=:BHFERTKZ:,BHLIEFNR=:BHLIEFNR:,BHFILLER1=:BHFILLER1:,BHLAN=:BHLAN:,BHKUNDNR=:BHKUNDNR:,BHHERART=:BHHERART:,BHSTATUS=:BHSTATUS:,BHSTAKZ=:BHSTAKZ:,BHGASTUE=:BHGASTUE:,BHBASTUE=:BHBASTUE:,BHAUFTR=:BHAUFTR:,BHKGNET=:BHKGNET:,BHLGG=:BHLGG:,BHRSP=:BHRSP:,BHSCHLIGR1=:BHSCHLIGR1:,BHSCHLIGR2=:BHSCHLIGR2:,BHSCHLIGR3=:BHSCHLIGR3:,BHSCHLIGR4=:BHSCHLIGR4:,BHSCHLIGR5=:BHSCHLIGR5:,BHSCHLIGR6=:BHSCHLIGR6:,BHSCHLIGR7=:BHSCHLIGR7:,BHSCHLIGR8=:BHSCHLIGR8:,BHSCHLIGR9=:BHSCHLIGR9:,BHSCHLIGR10=:BHSCHLIGR10:,BHSCHLIGR11=:BHSCHLIGR11:,BHSCHLIGR12=:BHSCHLIGR12:,BHSCHLIGR13=:BHSCHLIGR13:,BHSCHLIGR14=:BHSCHLIGR14:,BHSCHLIGR15=:BHSCHLIGR15:,BHSCHLINR1=:BHSCHLINR1:,BHSCHLINR2=:BHSCHLINR2:,BHSCHLINR3=:BHSCHLINR3:,BHSCHLINR4=:BHSCHLINR4:,BHSCHLINR5=:BHSCHLINR5:,BHSCHLINR6=:BHSCHLINR6:,BHSCHLINR7=:BHSCHLINR7:,BHSCHLINR8=:BHSCHLINR8:,BHSCHLINR9=:BHSCHLINR9:,BHSCHLINR10=:BHSCHLINR10:,BHSCHLINR11=:BHSCHLINR11:,BHSCHLINR12=:BHSCHLINR12:,BHSCHLINR13=:BHSCHLINR13:,BHSCHLINR14=:BHSCHLINR14:,BHSCHLINR15=:BHSCHLINR15:,BHCADKEY=:BHCADKEY:,BHBEM=:BHBEM:,BHDEKPR=:BHDEKPR:,BHZUGMENG=:BHZUGMENG:,BHVRPR=:BHVRPR:,BHLEPR=:BHLEPR:,BHBWPR1=:BHBWPR1:,BHBWPR2=:BHBWPR2:,BHBWPR3=:BHBWPR3:,BHMATKTO=:BHMATKTO:,BHKTO1=:BHKTO1:,BHEG=:BHEG:,BHBON=:BHBON:,BHZUSCHL11=:BHZUSCHL11:,BHZUSCHL12=:BHZUSCHL12:,BHZUSCHL13=:BHZUSCHL13:,BHZUSCHL21=:BHZUSCHL21:,BHZUSCHL22=:BHZUSCHL22:,BHZUSCHL23=:BHZUSCHL23:,BHABSABF=:BHABSABF:,BHKALABF=:BHKALABF:,BHAUFKZ=:BHAUFKZ:,BHKETTLG=:BHKETTLG:,BHFERTZT=:BHFERTZT:,BHWDBSZT=:BHWDBSZT:,BHDISPOKZ=:BHDISPOKZ:,BHDISPOZR=:BHDISPOZR:,BHMINBST=:BHMINBST:,BHMAXBST=:BHMAXBST:,BHBSLPKT=:BHBSLPKT:,BHLO=:BHLO:,BHLB=:BHLB:,BHABCKL=:BHABCKL:,BHSACHDSP=:BHSACHDSP:,BHPROF=:BHPROF:,BHPRUEFANW=:BHPRUEFANW:,BHTAX=:BHTAX:,BHBKLAS=:BHBKLAS:,BHSCHLIAUF=:BHSCHLIAUF:,BHFILLER=:BHFILLER:"
                          + " WHERE BHMANDANT=:BHMANDANT: AND BHKART=:BHKART:  AND BHKVAR=:BHKVAR:";

            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public DataSet QueryBHSATZ(DataRow dwData, int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0: SResult = QBH00(dwData); break;
                case 1: SResult = QBH01(dwData); break;
                case 2: SResult = QBH02(dwData); break;
                case 3: SResult = QBH03(dwData); break;
            }
            return SResult;
        }
        public DataSet QBH00(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM BHSATZ WHERE  ROWNUM<2 ";
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QBH01(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM BHSATZ"
           + " WHERE BHMANDANT=:BHMANDANT: AND BHKART=:BHKART: AND BHKVAR=:BHKVAR:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QBH02(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT  WF.* FROM WDECK WD "
                + " JOIN WASTKE ON WDMANDANT=WAKMANDANT AND WDART=WAKART AND WDVAR=WAKVAR AND WDFARBE=WAKWCOL"
                + " JOIN BHSATZ WF ON BHMANDANT=WAKMANDANT AND BHKART=WAKKART AND BHKVAR=WAKKVAR"
                + " WHERE WDMANDANT=:WDMANDANT: AND WDSA='K' AND WDTYP='B' AND WDWAKZ='F' AND WDAUFKRS=:WDAUFKRS:  AND WDAUFLFD=:WDAUFLFD:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QBH03(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT DISTINCT M.* FROM BHSATZ M JOIN ABPOS ON ABPMANDANT=BHMANDANT AND ABPART=BHKART AND ABPVAR=BHKVAR"
           + " WHERE ABPMANDANT=:ABPMANDANT: AND ABPAUFKRS=:ABPAUFKRS: AND ABPAUFLFD=:ABPAUFLFD:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QBH04(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT BHKART,BHKVAR, BHKART AS KEY,BHKART AS DES FROM BHSATZ P"
           + " WHERE BHMANDANT=:BHMANDANT: "
           + dwData["BHKART"].ToString()
           ;
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QBH05(DataRow dwData)
        {

            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM BHSATZ"
           + " WHERE BHMANDANT=:BHMANDANT: AND BHKART=:BHKART: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
    }
}
